import 'dart:convert';

import 'package:flutter/cupertino.dart';

/// MVVM基础视图层
/// 承接一些视图层功能能力
mixin GTMVVMBaseView {
  var routeParams = {};
  /// 解析路由参数，返回json格式
  void getRouteParams(BuildContext context) {
    var params = ModalRoute.of(context)?.settings.arguments as String?;
    if (params == null) {
      routeParams = jsonDecode("{}");
    } else {
      try {
        routeParams = jsonDecode(params);
      } catch (e) {
        routeParams = jsonDecode("{}");
      }
    }
  }
}
